package com.station.service.mapper;

import com.station.annotation.DataSource;
import com.station.vo.ShiftDetail;
import com.station.vo.ShiftOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @BelongsProject: newblderp
 * @BelongsPackage: com.station.service.mapper
 * @Author: songhui
 * @CreateTime: 2025-10-21  09:28
 * @Description: TODO
 * @Version: 1.0
 */
@Mapper
public interface TransferOrderMapper {


    @DataSource("erp")
    @Select("select " +
            "* " +
            "from shiftdetail " +
            "where orderNo = #{orderNo} and df=0 ")
    List<ShiftDetail> queryOrderDetailList(String orderNo);

    @DataSource("erp")
    @Select(" select \n" +
            " * \n" +
            "  from shiftorder shi \n" +
            "where \n" +
            " shi.vendorId = #{vendorId} \n" +
            " and shi.df = 0\n" +
            " and shi.orderNo = #{orderNo} ")
    ShiftOrder queryOrderByOrderNo(@Param("vendorId")Long vendorId, @Param("orderNo") String orderNo);


    @DataSource("erp")
    @Select(" select \n" +
            " * \n" +
            "  from shiftorder shi \n" +
            "where \n" +
            " shi.vendorId = #{vendorId} \n" +
            " and shi.df = 0\n" +
            " and shi.approveDate >= STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')\n" +
            " and shi.approveDate <= STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s') \n" +
            " and shi.status=2 and shi.orderType=1 ")
    List<ShiftOrder> queryOrderList(@Param("vendorId")Long vendorId, @Param("startDate") String startDate, @Param("endDate") String endDate);
}
